<%--
  Created by IntelliJ IDEA.
  User: dzw
  Date: 2017/12/12
  Time: 10:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";

%>

<div id="page-content">
  <div class="row">

    <div class="col-lg-12">
      <div class="panel">
        <div class="panel-heading">
          <h3 class="panel-title">离职申请</h3>
        </div>
        <div class="panel-body">
          <div class="form-inline">
            <div class="row">
              <div class="col-sm-12 table-toolbar-left">
                <btn id="btn_add_quit" class="btn btn-primary btn-sm" ${isStart}>
                  <i class="ti-plus"> </i> 新建离职申请
                </btn>
              </div>
            </div>
          </div>
          <div class="table-jqgrid">
            <table id="quit_table"></table>
            <div id="quit_page"></div>
          </div>
        </div>
      </div>
    </div>

  </div>
</div>

<script>

  $(function(){

    init_grid_quit();

  });

  function init_grid_quit() {
    __init_jqgrid('quit_table', 'quit_page',
            '<%=path%>/com/quit/list?viewtype=${viewtype}',
            ['离职人员',"离职日期",'交接人员',<c:if test="${viewtype==1}">"审批人",</c:if>"操作","id"],
            [
              {name:'quitUser',index:'quitUser', width:100,search:true,sortable:true, searchoptions: {sopt: ['cn']}},
              {name:'quitDate',index:'quitDate', width:100,search:true,sortable:true, searchoptions: {sopt: ['cn']}},
              {name:'nextUser',index:'nextUser', width:100,search:true,sortable:true, searchoptions: {sopt: ['cn']}},
              <c:if test="${viewtype==1}">
              {name:'editor',index:'editor', width:100,search:true,sortable:true, searchoptions: {sopt: ['cn']}},
              </c:if>
              {name:'act',index:'act', width:210,sortable:false,search:false,fixed:true,formatter: actFormat},
              {name:'id',index:'id',search:false,hidden:true}
            ],
            true,true
    );
  }

  function actFormat(cellvalue, options, rowObject){
    var id = rowObject.id;
    cellvalue = '<button class="btn btn-white btn-sm" onclick="fn_quit_read(\'' + id + '\');"><i class="fa fa-eye"> </i> 查看</button>';
    return cellvalue;
  }

  function fn_quit_read(id) {
    loadURL('<%=path%>/com/quit/read?keyId='+id+'&viewtype=${viewtype}', $('#page-content'));
  }

  $("#btn_add_quit").click(function(){
    loadURL('<%=path%>/com/quit/input', $('#page-content'));
  });

</script>